#ifndef FOOTMARKEDITVIEW_H
#define FOOTMARKEDITVIEW_H


#include <QWidget>
#include <QVBoxLayout>
#include <QPaintEvent>
#include <QFont>
#include <QPointF>
#include <QString>

#include <QLineEdit>
#include <QComboBox>
#include <QPushButton>
#include <QStackedLayout>

#include "kesyssetting.h"
#include "mcore/map/MapObject.h"
#include "kemode/mode/kefootmark.h"
#include "kemode/dao/wp/KeFootmarkDao.h"

namespace kepen {
namespace core {

class FootmarkEditView : public QWidget
{
    Q_OBJECT
public:
    FootmarkEditView(QWidget *parent,kepen::kemod::KeFootmark *node,KeSysSetting *sys);
    ~FootmarkEditView();

public:
    void setDataSource(kepen::core::MapObject* map
                       ,kepen::kemod::KeFootmarkDao *d
                       );
    kepen::kemod::KeFootmark *getData();
private:
    void initWidget(KeSysSetting *conf);

    QWidget *buildHead(QWidget *parent, QFont &fontIcon);
    QWidget *buildInputItem(QWidget *parent,QLineEdit ** input,const char*label,int maxLength);
    QWidget *buildInputItem2(QWidget *parent,QLineEdit ** input,int maxLength);


    QWidget *buildLocate(QWidget *parent, QFont &fontIcon);

    void view2NodeValue();
    void nodeValue2View();
    bool tyrParsePointCoords(const QString txt, double &x,double &y);

    void popHintMsg(QLineEdit * input,const QString &msg);
private:
    quint32 indexTmp;
    quint32 flag;
    quint32 hashNode;
     kepen::core::MapObject *mapSurface;
     kepen::kemod::KeFootmarkDao *dao;

     QLineEdit * inputName;
     QLineEdit * inputAddr;
     QLineEdit * inputCoords;
     QLineEdit * inputRemark;

    std::unique_ptr<kepen::kemod::KeFootmark> nodePtr;

private Q_SLOTS:

    void onBtnCloseClicked();
    void onBtnSaveClicked();

Q_SIGNALS:
    void stackedWidgetClosed(quint32 flag,QWidget* widget);


};

}
}
#endif // FOOTMARKEDITVIEW_H
